﻿using System;
using System.Collections.Generic;
using System.Text;
using Telerik.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI;

namespace Acms.WebControls
{
    public class RadGridDeleteColumn : GridButtonColumn
    {
        public RadGridDeleteColumn()
        {
            this.Text = "Delete";
            this.ConfirmText = "Are you sure?";
            this.CommandName = "Delete";
        }

        public override void PrepareCell(System.Web.UI.WebControls.TableCell cell, GridItem item)
        {
            base.PrepareCell(cell, item);
            if (item is GridDataItem)
            {
                foreach (Control ctrl in cell.Controls)
                {
                    LinkButton tmp = ctrl as LinkButton;
                    if (tmp != null)
                    {
                        if (tmp.CommandName == "Delete")
                        {
                            tmp.CssClass = "delete";
                        }
                    }
                }
            }
        }

        public override GridColumn Clone()
        {
            return new RadGridDeleteColumn();
        }
    }
}
